//
//  GFCalendarCell.m
//
//  Created by Mercy on 2016/11/9.
//  Copyright © 2016年 Mercy. All rights reserved.
//

#import "GFCalendarCell.h"
#import "UIColor+CL.h"
@implementation GFCalendarCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.biankuang];
        [self addSubview:self.bottomImg];
        [self addSubview:self.todayCircle];
        [self addSubview:self.todayIcon];
        [self addSubview:self.todayCircleImg];
        [self addSubview:self.todayLabel];
        [self.todayCircleImg addSubview:self.num];
        
        
    }
    
    return self;
}

-(UIView *)biankuang{
    if (_biankuang == nil) {
        _biankuang = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 1 * self.bounds.size.width, 1 * self.bounds.size.height)];
        _biankuang.center = CGPointMake(0.5 * self.bounds.size.width, 0.5 * self.bounds.size.height);
        _biankuang.backgroundColor =[UIColor whiteColor];
        _biankuang.layer.borderColor = [[UIColor colorWithHex:0xdcdcdc]CGColor];
        _biankuang.layer.borderWidth = 0.5;
        //        UIView *linetop = [[UIView alloc]initWithFrame:CGRectMake(0, 1 * self.bounds.size.height-0.5, 1 * self.bounds.size.width, 0.5)];
        //        [_todayCircle addSubview:linetop];
        //        linetop.backgroundColor =[UIColor colorWithHex:0xdcdcdc];
        //        _todayCircle.layer.cornerRadius = 0.3 * _todayCircle.frame.size.width;
    }
    return _biankuang;
}

- (UIView *)todayCircle {
    if (_todayCircle == nil) {
        _todayCircle = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 1 * self.bounds.size.width, 1 * self.bounds.size.height)];
        _todayCircle.center = CGPointMake(0.5 * self.bounds.size.width, 0.5 * self.bounds.size.height);
        
//        UIView *linetop = [[UIView alloc]initWithFrame:CGRectMake(0, 1 * self.bounds.size.height-0.5, 1 * self.bounds.size.width, 0.5)];
//        [_todayCircle addSubview:linetop];
//        linetop.backgroundColor =[UIColor colorWithHex:0xdcdcdc];
//        _todayCircle.layer.cornerRadius = 0.3 * _todayCircle.frame.size.width;
    }
    return _todayCircle;
}

- (UIView *)todayIcon {
    if (_todayIcon == nil) {
        _todayIcon = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.5 * self.bounds.size.width, 0.5 * self.bounds.size.width)];
        _todayIcon.center = CGPointMake(0.5 * self.bounds.size.width, 20);
        _todayIcon.layer.cornerRadius = 0.25 * self.bounds.size.width;
        _todayIcon.backgroundColor =[UIColor colorWithHex:0xfb5a1b];
    }
    return _todayIcon;
}


- (UIImageView *)todayCircleImg {
    if (_todayCircleImg == nil) {
        _todayCircleImg = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 22, 15)];
        _todayCircleImg.center = CGPointMake(0.5 * self.bounds.size.width, (1 * self.bounds.size.height)-15);
//        _todayCircleImg.backgroundColor = [UIColor redColor];
    }
    return _todayCircleImg;
}

-(UIImageView *)bottomImg{
    if (_bottomImg == nil) {
        _bottomImg = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, self.bounds.size.height*1-21, 21, 21)];
        //        _todayCircleImg.backgroundColor = [UIColor redColor];
    }
    return _bottomImg;
}


- (UILabel *)todayLabel {
    if (_todayLabel == nil) {
        _todayLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, self.bounds.size.width, 30)];
        _todayLabel.textAlignment = NSTextAlignmentCenter;
        _todayLabel.font = [UIFont boldSystemFontOfSize:15.0];
        _todayLabel.backgroundColor = [UIColor clearColor];
    }
    return _todayLabel;
}

- (UILabel *)num {
    if (_num == nil) {
        _num = [[UILabel alloc] initWithFrame:CGRectMake(15, 3, 14, 15)];
        _num.textAlignment = NSTextAlignmentCenter;
        _num.center = CGPointMake(_todayCircleImg.bounds.size.width-5, _todayCircleImg.bounds.size.height*0.5);
        _num.font = [UIFont boldSystemFontOfSize:9.0];
        _num.backgroundColor = [UIColor clearColor];\
        _num.textColor =[UIColor colorWithHex:0xffffff];
    }
    return _num;
}

@end
